<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<div class="sub-page-right">
	<div class="shadow box-7 bot-2">
	    <h2 class="p2">最新文章</h2>
	    <?php
	//如果有此参数，就是要实现分页效果
	if(0){
		//总条数
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->count();
		$pageObj = new Page($total,0,5);
		$page = $pageObj->show();
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->limit($pageObj->limit())->order('sendtime DESC')->all();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" category_cid in(22)")->limit(2)->order('sendtime DESC')->all();
	}
	foreach($arcData as $field):
	//评论总条数
	$field['total'] = K('Comment')->where("article_aid=" . $field['aid'])->count();
	//文章地址
	$field['url'] = getArcUrl($field['is_archtml'],$field['htmldir'],$field['aid']);
	//文章缩略图
	$field['thumb'] = "http://localhost/cms_edu/" . $field['thumb'];
?>

		    <p class="text-3 p2"><?php echo $field['title'];?></p>
		    <p class="upper"><?php echo $field['attr'];?>  <span>发表时间:<?php echo date('m-d H:i:s',$field['sendtime']);?></span></p>
		    <img src="<?php echo $field['thumb'];?>" alt="文章图片" style="width: 190px;height: 120px;">
		    <a href="<?php echo $field['url'];?>" class="button-2 top-3">Read More</a>
		    <p class="text-3 p2"> </p>
		
<?php
	endforeach
?>
	</div>
</div>